import { getStepListBasicDataAsync } from "./getStepListBasicDataAsync"
import { StepEngine } from "../consts/stepEngine"
import { getFlatSuiteDetail } from "./getData"

// 获取suite的步骤信息，包含除id外的额外信息，比如 ajax的url/remark；element的selector/remark；mock的remark
export const getStepListWithExtDataAsync = async (suiteId) => {
    const stepList = await getFlatSuiteDetail(suiteId)
    const basicData = await getStepListBasicDataAsync(stepList)
    const stepListWithExtData = stepList.map(stepDetail => StepEngine[stepDetail.code].appendExtData(stepDetail, basicData))

    return stepListWithExtData
}